package com.tw;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloServlet extends HttpServlet {

        /**
	 * 
	 */
	private static final long serialVersionUID = 1799336083736611673L;

		@Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
                        throws ServletException, IOException {
                req.setCharacterEncoding("UTF-8");
                resp.setCharacterEncoding("UTF-8");
                resp.setContentType("text/html; charset=utf-8");
                PrintWriter out = resp.getWriter();
                String userid = req.getParameter("userid");
                System.out.println(
                                new String(userid.getBytes("ISO-8859-1"))
                );
                
                out.println("HELLO, "+userid);
                
                
                
        }

        @Override
        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
                        throws ServletException, IOException {
                // TODO Auto-generated method stub
                doGet(req, resp);
        }

}
